<div class='right-cont right-cont-less' ng-controller='ShopCartBargainList'>
	<div class='title'>购物车销售记录<i class='fa fa-spinner fa-spin' ng-if='loading'></i></div>
	<div class='content'>
		<div class='box-ops clearfix'>
			<div class='box-search-key-date'>
				<div class='input-group input-group-date'>
					<input type='text' class='form-control input-date' placeholder='起始时间'
						ng-model='dateStart'>
					<span class='input-group-addon'>至</span>
					<input type='text' class='form-control input-date' placeholder='结束时间'
						ng-model='dateEnd'>
				</div>
				<input type='text' class='form-control input-keyword' placeholder='关键词'
					ng-model='keyword'>
				<button class='btn btn-primary' ng-click='load_data(1)'>搜索</button>
				<button class='btn btn-success' ng-click='out_excel()'>导出</button>
				<button class='btn btn-warning' data-toggle='modal' data-target='.modal.bargain-total'>合计</button>
			</div>
		</div>
		<div class='box-list'>
			<table class='table table-list'>
				<tr>
					<td>订单ID <span class='fa fa-sort'></span></td>
                    <td>用户ID <span class='fa fa-sort'></span></td>
					<td>微信昵称<span class='fa fa-sort'></span></td>
					<td>商品类型<span class='fa fa-sort'></span></td>
					<td>商品名称<span class='fa fa-sort'></span></td>
					<td>购买时间<span class='fa fa-sort'></span></td>
					<td>实际价格<span class='fa fa-sort'></span></td>
					<td>购买价格<span class='fa fa-sort'></span></td>
					<td>平台利润<span class='fa fa-sort'></span></td>
					<td>分成金额<span class='fa fa-sort'></span></td>
					<td>操作<span class='fa fa-sort'></span></td>
				</tr>
				<tr ng-repeat='item in list'>
					<td>{{item.money_id || '未知'}}</td>
                    <td>{{item.user_id || '未知'}}</td>
					<td>{{item.nickname || '未知'}}</td>
					<td>{{item.goods_type_text || '未知'}}</td>
					<td>{{item.goods_names || '未知'}}</td>
					<td>{{item.create_date || '未知'}}</td>
					<td>{{item.price || 0}}</td>
					<td>{{item.amount || 0}}</td>
					<td>{{item.profit || 0}}</td>
					<td>{{item.deduct || 0}}</td>
					<td>
						<button class='btn btn-primary btn-xs btn-w-xs' 
							ng-click='detail(item)'>
							详情
						</button>
					</td>
				</tr>
			</table>
			<div class='box-page' ng-bind-html='pageHtml'></div>
		</div>
	</div>
	
	<!--交易详情模态窗-->
	<div class='modal fade bargain-detail'>
        <div class='modal-dialog'>
            <div class='modal-content'> 
                <div class='modal-header'>
                    交易详情
                    <a class='close' data-dismiss='modal'>&times;</a>
                </div>
                <div class='modal-body'>
                    <table class='table-info'>
                        <tr>
                            <td>付款用户:</td>
                            <td>{{nItemInfo.nickname || '未知'}}</td>
                            <td>交易金额:</td>
                            <td>{{nItemInfo.amount || 0}}</td>
                            <td>交易时间:</td>
                            <td>{{nItemInfo.create_date || '未知'}}</td>
                        </tr>
                        <tr>
                            <td>交易单号:</td>
                            <td colspan='3'>{{nItemInfo.trade_no || '未知'}}</td>
                            <td>平台利润:</td>
                            <td>{{nItemInfo.profit || 0}}</td>
                        </tr>
                        <tr>
                            <td>优惠券码:</td>
                            <td colspan='3'>{{nMoneyInfo.code || '无'}}</td>
                            <td>抵扣金额:</td>
                            <td>{{nMoneyInfo.code_amount || '无'}}</td>
                        </tr>
                        <tr ng-repeat='deductInfo in nDeductList'>
                            <td>分成用户:</td>
                            <td>{{deductInfo.nickname || '无'}}</td>
                            <td>用户角色:</td>
                            <td>{{deductInfo.role_text || '无'}}</td>
                            <td>分红金额:</td>
                            <td>{{deductInfo.amount || '无'}}</td>
                        </tr>
                        <tr ng-if='!nDeductList'>
                            <td>分成用户:</td>
                            <td>无</td>
                            <td>用户角色:</td>
                            <td>无</td>
                            <td>分红金额:</td>
                            <td>无</td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <!-- 合计信息模态窗 -->
    <div class='modal fade bargain-total'>
        <div class='modal-dialog'>
            <div class='modal-content'> 
                <div class='modal-header'>
                    合计信息
                    <a class='close' data-dismiss='modal'>&times;</a>
                </div>
                <div class='modal-body'>
                    <table class='table-info'>
                        <tr>
                            <td>售出数量:</td>
                            <td>{{total.count || 0}}笔</td>
                            <td>交易金额:</td>
                            <td>{{total.amount || 0}}元</td>
                        </tr>
                        <tr>
                            <td>平台利润:</td>
                            <td>{{total.profit || 0}}元</td>
                            <td>分红金额:</td>
                            <td>{{total.deduct || 0}}元</td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>